package com.cmxh.shipper.controller;

import com.cmxh.shipper.pojo.Station;
import com.cmxh.shipper.service.StationService;
import com.cmxh.shipper.util.Code;
import com.cmxh.shipper.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/station")
public class StationController {
    @Autowired
    private StationService stationService;
    //查询所有站点
    @RequestMapping("/selectAll")
    public Result selectAll() {
        List<Station> stations = stationService.selectAll();
        if (stations != null) {
            return new Result(Code.GET_OK,stations, "查询成功");
        } else {
            return new Result(Code.GET_ERR, "查询失败");
        }
    }
}
